from django.conf import settings
from django.urls import include, re_path
from django.views.generic import TemplateView
from django.contrib import admin

# 启用Django admin
admin.autodiscover()

urlpatterns = [
    # 管理后台
    re_path(r'^admin/', admin.site.urls),
    
    # 首页
    re_path(r"^$", TemplateView.as_view(template_name="homepage.html"), name="home"),
    
    # 基础页面
    re_path(r"^about/$", TemplateView.as_view(template_name="about.html"), name="about"),
    re_path(r"^about_us/$", TemplateView.as_view(template_name="direct_pages/about_us.html"), name="about_us"),
    re_path(r"^contacts$", TemplateView.as_view(template_name="direct_pages/about_us.html"), name="contacts"),
    
    # MES业务应用URL（逐步启用）
    # re_path(r"^quality/", include("apps.quality.urls")),
    # re_path(r"^report/", include("apps.report.urls")),
    # re_path(r"^barcode/", include("apps.yt_barcode.urls")),
    # re_path(r"^file/", include("apps.yt_file.urls")),
    # re_path(r"^yt_report/", include("apps.yt_report.urls")),
    
    # 暂时注释掉的应用URL
    # re_path(r"^companydepartment/", include("apps.companydepartment.urls")),
    # re_path(r"^technology/", include("apps.technologies.urls")),
    # re_path(r"^manufactureplan/", include("apps.manufactureplan.urls")),
    # re_path(r"^warehouse/", include("apps.warehouse.urls")),
]

# 静态文件服务（仅在开发模式下）
if settings.DEBUG:
    from django.conf.urls.static import static
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) 